﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Globalization;

namespace produccion.forms
{
    /// <summary>
    /// Lógica de interacción para FRMprogpro.xaml
    /// </summary>
    public partial class FRMprogpro : Window
    {
        ordenprodauto _ordenprodauto;

        public FRMprogpro()
        {
            InitializeComponent();
            _ordenprodauto = (ordenprodauto)this.DataContext;
        }

        public delegate void PreviewMouseLeftButtonDown_delegate(object obj, MouseButtonEventArgs  args);

        private void datPedTalla_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            DataGridBoundColumn c = (DataGridBoundColumn)e.Column;
            c.Binding = new Binding(e.PropertyName) { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged };

            if (c.Header.ToString().Equals("Orden") || c.Header.ToString().Equals("Total") || c.Header.ToString().Equals("Asignada"))
            {
                c.IsReadOnly = true;
            }

            if (c.Header.ToString().Equals("Ok"))
            {
                c.IsReadOnly = true;
                //Style sty = new Style();
                //EventSetter est = new EventSetter(Control.MouseLeftButtonDownEvent, new MouseButtonEventHandler(this.DataGridCell_PreviewMouseLeftButtonDown));
                //sty.Setters.Add(est);
                //e.Column.CellStyle = sty;
                //c.CellStyle = sty;
            }

            // Ocultar columnas en el grid
            if (c.Header.ToString().Equals("Cantidad") || c.Header.ToString().Equals("CodCortador1") || c.Header.ToString().Equals("CodCortador2") || c.Header.ToString().Equals("CodCortador3") || c.Header.ToString().Equals("PorCortador1") || c.Header.ToString().Equals("PorCortador2") || c.Header.ToString().Equals("PorCortador3"))
            {
                e.Cancel = true;
            }

            if (e.Column.Header.ToString() == "Total")
            {
                (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
            }

            // ocultar columnas en el grid, definir tamaños de columnas
            switch (_ordenprodauto.numTotalTallas)
            {
                case 1:
                    if (c.Header.ToString().Equals("numTalla2") || c.Header.ToString().Equals("numTalla3") || c.Header.ToString().Equals("numTalla4") || c.Header.ToString().Equals("numTalla5") || c.Header.ToString().Equals("numTalla6") || c.Header.ToString().Equals("numTalla7") || c.Header.ToString().Equals("numTalla8") || c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 175;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 2:
                    if (c.Header.ToString().Equals("numTalla3") || c.Header.ToString().Equals("numTalla4") || c.Header.ToString().Equals("numTalla5") || c.Header.ToString().Equals("numTalla6") || c.Header.ToString().Equals("numTalla7") || c.Header.ToString().Equals("numTalla8") || c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 165;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 3:
                    if (c.Header.ToString().Equals("numTalla4") || c.Header.ToString().Equals("numTalla5") || c.Header.ToString().Equals("numTalla6") || c.Header.ToString().Equals("numTalla7") || c.Header.ToString().Equals("numTalla8") || c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 155;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 4:
                    if (c.Header.ToString().Equals("numTalla5") || c.Header.ToString().Equals("numTalla6") || c.Header.ToString().Equals("numTalla7") || c.Header.ToString().Equals("numTalla8") || c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 145;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 5:
                    if (c.Header.ToString().Equals("numTalla6") || c.Header.ToString().Equals("numTalla7") || c.Header.ToString().Equals("numTalla8") || c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 130;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 6:
                    if (c.Header.ToString().Equals("numTalla7") || c.Header.ToString().Equals("numTalla8") || c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 125;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 7:
                    if (c.Header.ToString().Equals("numTalla8") || c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 115;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    break;
                case 8:
                    if (c.Header.ToString().Equals("numTalla9") || c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 110;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 9:
                    if (c.Header.ToString().Equals("numTalla10") || c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 100;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla9")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[10].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 10:
                    if (c.Header.ToString().Equals("numTalla11") || c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 90;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla9")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[10].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla10")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[11].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 11:
                    if (c.Header.ToString().Equals("numTalla12") || c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 80;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla9")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[10].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla10")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[11].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla11")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[12].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 12:
                    if (c.Header.ToString().Equals("numTalla13") || c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 70;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla9")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[10].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla10")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[11].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla11")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[12].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla12")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[13].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 13:
                    if (c.Header.ToString().Equals("numTalla14") || c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 60;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla9")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[10].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla10")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[11].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla11")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[12].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla12")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[13].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla13")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[14].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 14:
                    if (c.Header.ToString().Equals("numTalla15"))
                    {
                        e.Cancel = true;
                    }
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 50;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla9")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[10].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla10")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[11].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla11")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[12].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla12")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[13].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla13")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[14].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla14")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[15].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                case 15:
                    if (c.Header.ToString().Equals("Cortador1") || c.Header.ToString().Equals("Cortador2") || c.Header.ToString().Equals("Cortador3"))
                    {
                        c.Width = 40;
                        c.IsReadOnly = true;
                    }
                    if (e.Column.Header.ToString() == "numTalla1")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[2].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla2")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[3].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla3")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[4].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla4")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[5].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla5")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[6].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla6")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[7].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla7")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[8].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    } 
                    if (e.Column.Header.ToString() == "numTalla8")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[9].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla9")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[10].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla10")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[11].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla11")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[12].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla12")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[13].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla13")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[14].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla14")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[15].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    if (e.Column.Header.ToString() == "numTalla15")
                    {
                        c.Width = 25;
                        e.Column.Header = _ordenprodauto.lisPedTalla.Columns[16].ColumnName.ToString();
                        (e.Column as DataGridTextColumn).Binding.StringFormat = "{0:##,##.##}";
                        (e.Column as DataGridTextColumn).CellStyle = newCellStyleAlinearDerecha();
                    }
                    break;
                default:
                    break;
            }

            if (e.Column.Header.ToString() == "IsNotificationEnabled")
            {
                c.Visibility = System.Windows.Visibility.Hidden;
            }
        }

        private void butAce_Click(object sender, RoutedEventArgs e)
        {
            _ordenprodauto.cargarOrdenes();
            this.Close();
        }

        private void butSal_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void datPedTalla_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (datPedTalla.CurrentColumn != null)
            {
                if (datPedTalla.CurrentColumn.Header.Equals("Asignada"))
                {
                    FRMasigcort asi = new FRMasigcort();
                    asi.ShowDialog();
                }
            }
        }

        private void datPedTalla_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            var elemento = e.OriginalSource as UIElement;
            if (e.Key == Key.Enter && elemento != null)
            {
                e.Handled = true;
                elemento.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
                _ordenprodauto.Recalcular();
            }
        }

        private void but_Click(object sender, RoutedEventArgs e)
        {
            _ordenprodauto.queryPedTallaProcesar();
        }

        public static Style newCellStyleAlinearDerecha()
        {
            System.Windows.Style style = new Style(typeof(DataGridCell));
            style.Setters.Add(new System.Windows.Setter
            {
                Property = Control.HorizontalAlignmentProperty,
                Value = HorizontalAlignment.Right
            });
            return style;
        }


        //
        // SINGLE CLICK EDITING
        //
        private void DataGridCell_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DataGridCell cell = sender as DataGridCell;
            if (cell != null && !cell.IsEditing && !cell.IsReadOnly)
            {
                if (!cell.IsFocused)
                {
                    cell.Focus();
                }
                DataGrid dataGrid = FindVisualParent<DataGrid>(cell);
                if (dataGrid != null)
                {
                    if (dataGrid.SelectionUnit != DataGridSelectionUnit.FullRow)
                    {
                        if (!cell.IsSelected)
                            cell.IsSelected = true;
                    }
                    else
                    {
                        DataGridRow row = FindVisualParent<DataGridRow>(cell);
                        if (row != null && !row.IsSelected)
                        {
                            row.IsSelected = true;
                        }
                    }
                }
            }
        }

        static T FindVisualParent<T>(UIElement element) where T : UIElement
        {
            UIElement parent = element;
            while (parent != null)
            {
                T correctlyTyped = parent as T;
                if (correctlyTyped != null)
                {
                    return correctlyTyped;
                }

                parent = VisualTreeHelper.GetParent(parent) as UIElement;
            }
            return null;
        }

        private void datPedTalla_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (datPedTalla.CurrentColumn != null)
            {
                if (datPedTalla.CurrentColumn.Header.Equals("Ok"))
                {
                    _ordenprodauto.Ok = !_ordenprodauto.Ok;
                    _ordenprodauto.validarTodoAsig();
                    
                }
            }
        }

        private void progpro_KeyDown(object sender, KeyEventArgs e)
        {
            var elemento = e.OriginalSource as UIElement;
            if (e.Key == Key.F3 && elemento != null)
            {
                if (MDOgeneral.logBusquedadAbierta == true) { MDOgeneral.logBusquedadAbierta = false; }
            }

            if (e.Key == Key.F4 && elemento != null)
            {
                if (MDOgeneral.logBusquedadAbierta1 == true) { MDOgeneral.logBusquedadAbierta1 = false; }
            }

            if (e.Key == Key.F5 && elemento != null)
            {
                if (MDOgeneral.logBusquedadAbierta2 == true) { MDOgeneral.logBusquedadAbierta2 = false; }
            }
        }

        private void btnCopiarUsuario_Click(object sender, RoutedEventArgs e)
        {
            _ordenprodauto.copiarCortador();
        }

    }
}


namespace ReglasValidacion
{
    //validar  creacion orden de produccion
    public class esOKprogpro : ValidationRule
    {
        public Window progpro { get; set; }

        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            produccion.forms.ordenprodauto ordenprodauto = (produccion.forms.ordenprodauto)progpro.DataContext;
            ordenprodauto.ERRORPRO = true;
            
            var numtot1 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla1);
            var numtot11 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla1);
            if (numtot1<numtot11)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[2].ColumnName + " es mayor que la cantidad pedida.");

            var numtot2 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla2);
            var numtot21 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla2);
            if (numtot2 < numtot21)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[3].ColumnName + " es mayor que la cantidad pedida.");

            var numtot3 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla3);
            var numtot31 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla3);
            if (numtot3 < numtot31)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[4].ColumnName + " es mayor que la cantidad pedida.");

            var numtot4 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla4);
            var numtot41 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla4);
            if (numtot4 < numtot41)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[5].ColumnName + " es mayor que la cantidad pedida.");

            var numtot5 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla5);
            var numtot51 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla5);
            if (numtot5 < numtot51)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[6].ColumnName + " es mayor que la cantidad pedida.");

            var numtot6 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla6);
            var numtot61 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla6);
            if (numtot6 < numtot61)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[7].ColumnName + " es mayor que la cantidad pedida.");

            var numtot7 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla7);
            var numtot71 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla7);
            if (numtot7 < numtot71)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[8].ColumnName + " es mayor que la cantidad pedida.");

            var numtot8 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla8);
            var numtot81 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla8);
            if (numtot8 < numtot81)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[9].ColumnName + " es mayor que la cantidad pedida.");

            var numtot9 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla9);
            var numtot91 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla9);
            if (numtot9 < numtot91)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[10].ColumnName + " es mayor que la cantidad pedida.");

            var numtot10 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla10);
            var numtot101 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla10);
            if (numtot10 < numtot101)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[11].ColumnName + " es mayor que la cantidad pedida.");

            var numtot111 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla11);
            var numtot1111 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla11);
            if (numtot111 < numtot1111)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[12].ColumnName + " es mayor que la cantidad pedida.");

            var numtot12 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla12);
            var numtot121 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla12);
            if (numtot12 < numtot121)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[13].ColumnName + " es mayor que la cantidad pedida.");

            var numtot13 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla13);
            var numtot131 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla13);
            if (numtot13 < numtot131)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[14].ColumnName + " es mayor que la cantidad pedida.");

            var numtot14 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla14);
            var numtot141 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla14);
            if (numtot14 < numtot141)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[15].ColumnName + " es mayor que la cantidad pedida.");

            var numtot15 = ordenprodauto.lstDetalle.Where(x => x.Orden.Equals("Pendiente")).Sum(y => y.numTalla15);
            var numtot151 = ordenprodauto.lstDetalle.Where(x => x.Ok.Equals(true)).Sum(y => y.numTalla15);
            if (numtot15 < numtot151)
                return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[16].ColumnName + " es mayor que la cantidad pedida.");
            //for (int i = 2; i <= ordenprodauto.lisPedTalla.Columns.Count; i++)
            //{
            //    if (ordenprodauto.lisPedTalla.Columns[i].ColumnName.Equals("Total"))
            //    {
            //        break;
            //    }

            //    if(!String.IsNullOrEmpty(ordenprodauto.lisPedTalla.Rows[0][i].ToString()))
            //    {
            //        int sum = 0;
            //        for (int j = 1; j <= ordenprodauto.lisPedTalla.Rows.Count - 1; j++) {

            //            if (!String.IsNullOrEmpty(ordenprodauto.lisPedTalla.Rows[j][i].ToString()))
            //            {
            //                sum = sum+Convert.ToInt32(ordenprodauto.lisPedTalla.Rows[j][i]);
            //            }
            //        }
            //        if (sum > Convert.ToInt32(ordenprodauto.lisPedTalla.Rows[0][i]))
            //        {
            //            ordenprodauto.ERRORPRO = true;
            //            return new ValidationResult(false, "La cantidad programada para la talla " + ordenprodauto.lisPedTalla.Columns[i].ColumnName+" es mayor que la cantidad pedida.");
            //        }
            //    }
            //}

            ordenprodauto.ERRORPRO = false;
            ordenprodauto.validarTodoAsig();
            ordenprodauto.totalizarprog(); 
            return new ValidationResult(true, null);
        }
    }

}
